const fs = require("fs");
module.exports = {
  sum({ a, b }) {
    return {
      content: [
        {
          type: "text",
          text: `两个数求和结果为${a + b}`,
        },
      ],
    };
  },
  createFile({ filename, content }) {
    try {
      fs.writeFileSync(filename, content);
      return {
        content: [
          {
            type: "text",
            text: "文件创建成功",
          },
        ],
      };
    } catch (err) {
      return {
        content: [
          {
            type: "text",
            text: err.message || "文件创建失败",
          },
        ],
      };
    }
  },
};
